package com.xd.core.api.consumer;

import com.xd.core.api.entity.RepaymentOrderInfo;
import com.xd.core.api.mapper.RepaymentOrderInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import java.util.Date;

@Slf4j
@Component
@RabbitListener(queues = "delay.queueSignPay")
public class DelaySignPayConsumerController {
    @Autowired
    private RepaymentOrderInfoMapper repaymentOrderInfoMapper;

    //代扣申请失败
    @RabbitHandler
    public void SignPayFail(RepaymentOrderInfo repaymentOrderInfo) {
        log.info("代扣申请失败：{}", repaymentOrderInfo.getOrderNo());
        repaymentOrderInfo.setTradeTime(new Date());
        repaymentOrderInfoMapper.insert(repaymentOrderInfo);
    }
}
